package com.xnyzc.lhy.didi.mapper.price;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xnyzc.lhy.didi.entity.price.CharterRulesParam;
import com.xnyzc.lhy.mis.entity.system.NewBillRules;
import com.xnyzc.lhy.mis.entity.system.OaSysBillRule;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import org.apache.ibatis.annotations.Param;


public interface OaSysNewBillRuleMapper extends BaseMapper<NewBillRules> {
    //List<OaSysBillRule> selectList(@Param("vehicleType") Integer vehicleType, @Param("callType") Integer callType, @Param("areaId") Long areaId, @Param("channel") Integer channel);
    @Select("SELECT * FROM oa_sys_bill_rule\n" +
            "WHERE json_rules IS NOT NULL\n" +
            "AND city_id = #{areaId}\n" +
            "AND channel_id = #{channel}\n" +
            "AND call_type = #{callType}\n " +
            "AND rules_no = #{rulesNo}\n"+
            "AND deleted=0\n" +
            "ORDER BY update_time DESC\n" +
            "        LIMIT 1")
    List<NewBillRules> selectList2(@Param("callType") Integer callType, @Param("areaId") Long areaId, @Param("channel") Integer channel,@Param("rulesNo") Integer rulesNo);

    @Select("SELECT * FROM oa_sys_bill_rule\n" +
            "WHERE json_rules IS NOT NULL\n" +
            "AND city_id = #{areaId}\n" +
            "AND channel_id = #{channel}\n" +
            "AND call_type = #{callType}\n " +
            "AND rules_no is null\n"+
            "AND deleted=0\n" +
            "ORDER BY update_time DESC\n" +
            "        LIMIT 1")
    List<NewBillRules> selectList3(@Param("callType") Integer callType, @Param("areaId") Long areaId, @Param("channel") Integer channel);

    @Select("SELECT * FROM oa_sys_bill_rule\n" +
            "WHERE json_rules IS NOT NULL\n" +
            "AND city_id = #{areaId}\n" +
            "AND channel_id = #{channel}\n" +
            "AND call_type = 7\n " +
            "AND deleted=0\n"
    )
    List<NewBillRules> selectCharterRules(@Param("channel") Integer channel, @Param("areaId") Long areaId);
}
